﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace HA.ModFlow.Domain.DomainLayer
{
    [Serializable]
    public class EVTPeriod : INotifyPropertyChanged, ICloneable
    {
        #region 构造函数

        public EVTPeriod(int rCount, int cCount)
        {
            this._elevation = new double[rCount,cCount];
            this._maxETRate = new double[rCount, cCount];
            this._extinctDepth = new double[rCount, cCount];
            this._evtLayer = new int[rCount, cCount];
            //evtLayer 初始值为1
            for(int i=0;i<rCount;i++)
              for (int j = 0; j < cCount; j++)
              {
                this._evtLayer[i, j] = 1;
              }
        }
        public EVTPeriod()
        { }
        #endregion

        double[,] _elevation;
        /// <summary>
        /// ET界面的高程
        /// </summary>
        public double[,] Elevation
        {
            get { return _elevation; }
            set { _elevation = value; }
        }

        double[,] _maxETRate;

        /// <summary>
        /// 最大ET通量（>=0）
        /// </summary>
        
        public double[,] MaxETRate
        {
            get { return _maxETRate; }
            set { _maxETRate = value; }
        }

        double[,] _extinctDepth;

        /// <summary>
        /// ET终止深度
        /// </summary>
    
        public double[,] ExtinctDepth
        {
            get { return _extinctDepth; }
            set { _extinctDepth = value; }
        }

        int[,] _evtLayer;

        /// <summary>
        /// 蒸发层位数组
        /// </summary>
        public int[,] EvtLayer
        {
            get { return _evtLayer; }
            set { _evtLayer = value; }
        }


        double _multiplier = 1.0;

        public double Multiplier
        {
            get { return _multiplier; }
            set
            {
                _multiplier = value;
                OnPropertyChanged("Multiplier");
            }
        }

        #region INotifyPropertyChanged

        [field:NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion

        #region ICloneable

        public object Clone()
        {
            EVTPeriod obj = new EVTPeriod();
            obj = (EVTPeriod)this.MemberwiseClone();
            obj._elevation =(double [,]) this._elevation.Clone();
            obj._evtLayer = (int[,])this._evtLayer.Clone();
            obj ._extinctDepth=(double [,])this ._extinctDepth.Clone ();
            obj._maxETRate = (double[,])this._maxETRate.Clone();
            
            return this.MemberwiseClone();
        }

        #endregion
    }
}
